package cn.rjzjh.tapestry.busi.model.ca;

// Generated 2014-9-6 10:25:55 by Hibernate Tools 4.0.0

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * CaOrganization generated by hbm2java
 */
@Entity
@Table(name = "CA_Organization")
public class CaOrganization implements java.io.Serializable {

	private int id;
	private CaOrganization caOrganization;
	private String orgName;
	private String orgPath;

	private String unitType;

	private Set<CaGroup> caGroups = new HashSet<CaGroup>(0);
	private Set<CaPosition> caPositions = new HashSet<CaPosition>(0);
	private Set<CaStaff> caStaffs = new HashSet<CaStaff>(0);
	private Set<CaOrganization> caOrganizations = new HashSet<CaOrganization>(0);

	public CaOrganization() {
	}

	public CaOrganization(int id) {
		this.id = id;
	}

	public CaOrganization(int id, String orgName, String unitType) {
		this.id = id;
		this.orgName = orgName;
		this.unitType = unitType;
	}

	public CaOrganization(String orgName, String unitType) {
		this.orgName = orgName;
		this.unitType = unitType;
	}

	public CaOrganization(int id, String unitType) {
		this.id = id;
		this.unitType = unitType;
	}

	public CaOrganization(int id, CaOrganization caOrganization,
			String orgName, String unitType, Set<CaGroup> caGroups,
			Set<CaPosition> caPositions, Set<CaStaff> caStaffs,
			Set<CaOrganization> caOrganizations) {
		this.id = id;
		this.caOrganization = caOrganization;
		this.orgName = orgName;
		this.unitType = unitType;
		this.caGroups = caGroups;
		this.caPositions = caPositions;
		this.caStaffs = caStaffs;
		this.caOrganizations = caOrganizations;
	}

	@Id()
	@Column(name = "id", unique = true, nullable = false, insertable = false, updatable = false)
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	public int getId() {
		return this.id;
	}

	public void setId(int id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "parentId")
	public CaOrganization getCaOrganization() {
		return this.caOrganization;
	}

	public void setCaOrganization(CaOrganization caOrganization) {
		this.caOrganization = caOrganization;
	}

	@Column(name = "orgName", nullable = false, length = 100)
	public String getOrgName() {
		return this.orgName;
	}

	public void setOrgName(String orgName) {
		this.orgName = orgName;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "caOrganization", cascade = { CascadeType.REMOVE })
	public Set<CaGroup> getCaGroups() {
		return this.caGroups;
	}

	public void setCaGroups(Set<CaGroup> caGroups) {
		this.caGroups = caGroups;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "caOrganization", cascade = { CascadeType.REMOVE })
	public Set<CaPosition> getCaPositions() {
		return this.caPositions;
	}

	public void setCaPositions(Set<CaPosition> caPositions) {
		this.caPositions = caPositions;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "caOrganization")
	public Set<CaStaff> getCaStaffs() {
		return this.caStaffs;
	}

	public void setCaStaffs(Set<CaStaff> caStaffs) {
		this.caStaffs = caStaffs;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "caOrganization")
	public Set<CaOrganization> getCaOrganizations() {
		return this.caOrganizations;
	}

	public void setCaOrganizations(Set<CaOrganization> caOrganizations) {
		this.caOrganizations = caOrganizations;
	}

	@Column(name = "unitType", nullable = false, length = 10)
	public String getUnitType() {
		return unitType;
	}

	public void setUnitType(String unitType) {
		this.unitType = unitType;
	}

	@Column(name = "orgPath", nullable = false, length = 2000)
	public String getOrgPath() {
		return orgPath;
	}

	public void setOrgPath(String orgPath) {
		this.orgPath = orgPath;
	}

}
